#include("../_common/form_input.html")
#@admin_header()
<!-- 内容主体区域 -->
<div class="layui-body">
  <div style="padding: 15px;">
    <form class="layui-form layui-form-pane">
      <fieldset class="layui-elem-field layui-field-title">
        <legend>用来增加设置字段，后期可以去掉</legend>
      </fieldset>
      #@form_input("cfg_key", "数据的键", "", "key", "该数据的唯一标识，不可与已有的重复")
      #@form_input("cfg_val", "数据的值", "", "value", "数据的实际值，可以为空")
      #@form_input("cfg_desc", "数据用途", "", "desc", "这个数据的用途，相当于字段的备注")
      <div class="layui-form-item">
        <div class="layui-input-block">
          <button class="layui-btn" lay-filter="infoConfig" lay-submit="">立即提交</button>
          <button class="layui-btn layui-btn-primary" type="reset">重置</button>
        </div>
      </div>
    </form>
  </div>
</div>
<script>
  //JavaScript代码区域
  layui.use(['form'], function () {
    var form = layui.form;
    form.render();
    // 提交
    form.on('submit(infoConfig)', function (data) {
      ToastLoading('正在保存...');
      $.post("#(adminRoot)/setting/added/save", data.field)
        .success(function (ret) {
          ToastShow(ret.code, ret.msg, ret.url);
        })
        .error(function () {
          ToastErr('网络错误');
        })
      return false;
    });
  });
</script>
#@admin_footer()
